import * as TYPES from '../action-types'

let initState= {
  userData:{},//后面来补
  userRoute:[]
}

export default function user(state=initState,action){

  state = JSON.parse(JSON.stringify(state))
  let {type,payload} = action
  
  switch (type) {
      case TYPES.Login:
          state.userData = payload
          break;
          case TYPES.Logout:
            state.userData = {}
            break;
            case TYPES.RouteAry:
              state.userRoute = payload
            break ; 
      default:
          break;
  }
  return state;
}